<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	pageContext.setAttribute("basePath",request.getContextPath());
%>
<!DOCTYPE html>
<html lang="zh">
<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="">
<meta name="description" content="">
<title>生产标准</title>
<link rel="shortcut icon" href="favicon.ico">
<link href="${basePath }/static/css/bootstrap.min.css" rel="stylesheet" />
<link href="${basePath }/static/css/font-awesome.min.css" rel="stylesheet" />
<!-- bootstrap-table 表格插件样式 -->
<link href="${basePath }/static/ajax/libs/bootstrap-table/bootstrap-table.min.css"
	rel="stylesheet" />
<link href="${basePath }/static/css/animate.css" rel="stylesheet" />
<link href="${basePath }/static/css/style.css" rel="stylesheet" />
<link href="${basePath }/static/ruoyi/css/ry-ui.css" rel="stylesheet" />


<link href="${basePath }/static/ajax/libs/jquery-layout/jquery.layout-latest.css"
	rel="stylesheet" />


<link
	href="${basePath }/static/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css"
	rel="stylesheet" />
</head>

<body class="gray-bg">
    <!--补全项目路径,JSP-->
    <%    pageContext.setAttribute("basePath",request.getContextPath()); %>

	<div class="ui-layout-center">
		<div class="container-div">
			<div class="row">
				<div class="col-sm-12 search-collapse">
					<form id="standard-form">
						<input type="hidden" id="deptId" name="deptId"> <input
							type="hidden" id="parentId" name="parentId">
						<div class="select-list">
							<ul>

								<li class="select-time"><label>时间： </label> <input
									type="text" class="time-input" id="startTime"
									placeholder="开始时间" name="params[beginTime]" /> <span>-</span>
									<input type="text" class="time-input" id="endTime"
									placeholder="结束时间" name="params[endTime]" /></li>
								<li><a class="btn btn-primary btn-rounded btn-sm"
									onclick="$.table.search()"> <i class="fa fa-search"></i>&nbsp;搜索
								</a> <a class="btn btn-warning btn-rounded btn-sm"
									onclick="$.form.reset()"> <i class="fa fa-refresh"></i>&nbsp;重置
								</a></li>
							</ul>
						</div>
					</form>
				</div>


				<div class="col-sm-12 select-table table-striped">
					<div class="bootstrap-table">
						<div class="fixed-table-toolbar">
							<div class="bs-bars pull-left">
								<div class="btn-group-sm" id="toolbar" role="group">
									<a class="btn btn-success" onclick=""> <i
										class="fa fa-download"></i> 批量导出
									</a> <a class="btn btn-info" onclick=""> <i
										class="fa fa-upload"></i> 导入
									</a>
									<button class="btn btn-info btn-primary btn-xs"
										data-toggle="modal" data-target="#addStandard" type="button">
										<i class="glyphicon glyphicon-floppy-disk"></i>&nbsp;&nbsp;<span
											class="bold">添加记录</span>
									</button>
								</div>
							</div>
						</div>


						<div class="fixed-table-container" style="padding-bottom: 0px;">
							<div class="fixed-table-header" style="display: none;">
								<table></table>
							</div>
							<div class="fixed-table-body">
								<table id="bootstrap-table" data-mobile-responsive="true"
									class="table table-hover">
									<thead>
										<tr>
											<th class="bs-checkbox " style="width: 36px;" data-field="0"
												tabindex="0">
												<div class="th-inner ">
													<input name="btSelectAll" type="checkbox">
												</div>
												<div class="fht-cell"></div>
											</th>
											<th>
												<div class="th-inner ">#</div>
												<div class="fht-cell"></div>
											</th>
											<th>
												<div class="th-inner ">茶叶名称</div>
												<div class="fht-cell"></div>
											</th>
											<th>
												<div class="th-inner ">标准id</div>
												<div class="fht-cell"></div>
											</th>
											<th>
												<div class="th-inner ">工序名称</div>
												<div class="fht-cell"></div>
											</th>
											<th>
												<div class="th-inner ">最后一次修改时间</div>
												<div class="fht-cell"></div>
											</th>
											<th>
												<div class="th-inner ">操作</div>
												<div class="fht-cell"></div>
											</th>
										</tr>
									</thead>

									<tbody id="recordList">
										<c:forEach items="${query.list}" var="standard" varStatus="status">
											<tr data-index="${status.count }">
												<td class="bs-checkbox "><input
													data-index="${status.count }" name="btSelectItem"
													type="checkbox"></td>
												<td>${status.count }</td>
												<td>${standard.teaName }</td>
												<td>${standard.standardId }</td>
												<c:if test="${standard.standardId>0&&standard.standardId<100000000}">
													<td>杀青</td>
												</c:if>
												<c:if test="${standard.standardId>100000000&&standard.standardId<200000000}">
													<td>揉捻</td>
												</c:if>
												<c:if test="${standard.standardId>200000000&&standard.standardId<300000000}">
													<td>干燥</td>
												</c:if>
												<c:if test="${standard.standardId>300000000}">
													<td>打包</td>
												</c:if>
												<td>${standard.lastModifyTime }</td>
												<td>
													<button class="btn btn-info btn-primary btn-xs"
														data-toggle="modal" data-target="#detailModal"
														type="button" onclick="showDetail(this)">
														<i class="fa fa-key"></i>&nbsp;&nbsp;<span class="bold">详细</span>
													</button>
													<button class="btn btn-success btn-xs" type="button">
														<i class="fa fa-download"></i>&nbsp;&nbsp;<span
															class="bold">导出</span>
													</button>
												</td>
											</tr>
										</c:forEach>
									</tbody>
								</table>
							</div>
							<div class="fixed-table-footer" style="display: none;">
								<table>
									<tbody>
										<tr></tr>
									</tbody>
								</table>
							</div>

							<!-- 分页 -->
							<div class="fixed-table-pagination" style="display: block;">
								<div class="pull-left pagination-detail">
									<span class="pagination-info">第${query.pageNum }页，共${query.pages + 1}页，共
										${query.total } 条记录。</span>
								</div>
								<div class="pull-right pagination">
									<ul class="pagination pagination-outline">
										<c:choose>
											<c:when test="${query.pageNum == 1 }">
												<li class="page-pre active"><a
													href="javascript:void(0)">‹</a></li>
											</c:when>
											<c:otherwise>
												<li class="page-pre"><a
													href="${basePath }/production/norm/getProductionStandard.do?pagenum=${query.pageNum - 1 }">‹</a>
												</li>
											</c:otherwise>
										</c:choose>

										<c:forEach items="${query.navigateNums }" var="num">
											<c:if test="${query.pageNum == num }">
												<li class="page-number active"><a
													href="javascript:void(0)">${num }</a></li>
											</c:if>
											<c:if test="${query.pageNum != num }">
												<li class="page-number"><a
													href="${basePath }/production/norm/getProductionStandard.do?pagenum=${num }">${num }</a>
												</li>
											</c:if>
										</c:forEach>
										<c:if test="${query.pageNum == query.pages+1 }">
											<li class="page-next active"><a
												href="javascript:void(0)">›</a></li>
										</c:if>
										<c:if test="${query.pageNum < query.pages }">
											<li class="page-next"><a
												href="${basePath }/production/norm/getProductionStandard.do?pagenum=${query.pageNum + 1 }">›</a>
											</li>
										</c:if>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="clearfix"></div>
			</div>
		</div>
	</div>
	</div>







	<!-- 添加记录模态框 -->

	<div class="modal inmodal fade" id="addStandard" tabindex="-1"
		role="dialog" aria-hidden="true" style="display: none;">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">
						<span aria-hidden="true">×</span><span class="sr-only">Close</span>
					</button>
					<h4 class="modal-title">添加生产标准</h4>
				</div>
				<small class="font-bold">
					<div class="modal-body" id="new-standard">
						<select class="form-control m-b" name="account" id="standardHead">
							<option value="none">--请选择记录类型--</option>
							<option value="form-fixation-body">杀青标准</option>
							<option value="form-twist-body">揉捻标准</option>
							<option value="form-dry-body">干燥标准</option>
							<option value="form-package-body">打包标准</option>
						</select>

						<!-- 杀青参数表单 -->
						<form class="new-standard-body form-fixation-body" hidden>
							
						<div class="form-group">
								<div class="input-group m-b">
									<span class="input-group-addon">请选择杀青阶段 </span>
									<select class="form-control m-b" name="fixationStage" id="standardHead">
										<option value="1">阶段一</option>
										<option value="2">阶段二</option>
									</select>
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">茶叶名称</span> <input type="text"
										placeholder="茶叶名称" name="teaName" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">鲜叶含水量</span> <input type="text"
										placeholder="鲜叶含水量" name="freshLeafWaterContent" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">标准投叶量</span> <input type="text"
										placeholder="标准投叶量" name="leafStandard" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">时长</span> <input type="text"
										placeholder="时长" name="timeStandard" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">温度标准</span> <input type="text"
										placeholder="温度标准" name="temperatureStandard"
										class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">湿度标准</span> <input type="text"
										placeholder="湿度标准" name="humidity"
										class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">杀青机转速</span> <input
										type="text" placeholder="杀青机转速" name="speedStandard"
										class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">风扇转速</span> <input
										type="text" placeholder="风扇转速" name="fanSpeed"
										class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">杀青机状态</span> <input
										type="text" placeholder="杀青机状态" name="killerStatus"
										class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">风扇状态</span> <input
										type="text" placeholder="风扇状态" name="fanStatus"
										class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">杀青后标准含水量</span> <input type="text"
										placeholder="杀青后标准含水量" name="waterStandard"
										class="form-control">
								</div>
								
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
								<button type="submit" class="btn btn-primary"
									onclick="FixationStandardCheck()">保存</button>
							</div>
						</form>
						
						<!-- 揉捻参数表单 -->
						<form class="new-standard-body form-twist-body" hidden>
							<div class="form-group">
								<div class="input-group m-b">
									<span class="input-group-addon">茶叶名称</span> <input type="text"
										placeholder="茶叶名称" name="teaName" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">标准投叶量</span> <input type="text"
										placeholder="标准投叶量" name="leafStandard" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">标准温度</span> <input type="text"
										placeholder="标准温度" name="temperatureStandard"
										class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">总时长</span> <input type="text"
										placeholder="总时长" name="timeStandard" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">设备标准转速</span> <input
										type="text" placeholder="设备标准转速" name="speedStandard"
										class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">标准含水量</span> <input type="text"
										placeholder="标准含水量" name="waterStandard" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">揉捻方式</span> <input type="text"
										placeholder="揉捻方式" name="twistType" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">标准成条率</span> <input type="text"
										placeholder="标准成条率" name="rateStandard" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">标准细胞破损率</span> <input
										type="text" placeholder="标准细胞破损率" name="cellRateStandard"
										class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">阶段1压力</span> <input type="text"
										placeholder="阶段1压力" name="pressureOne" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">阶段1时长</span> <input type="text"
										placeholder="阶段1时长" name="timeOne" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">阶段2压力</span> <input type="text"
										placeholder="阶段2压力" name="pressureTwo" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">阶段2时长</span> <input type="text"
										placeholder="阶段2时长" name="timeTwo" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">阶段3压力</span> <input type="text"
										placeholder="阶段3压力" name="pressureThree" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">阶段3压力</span> <input type="text"
										placeholder="阶段3压力" name="timeThree" class="form-control">
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
								<button type="submit" class="btn btn-primary"
									onclick="TwistStandardCheck()">保存</button>
							</div>
						</form>

						<!-- 干燥参数表单 -->
						<form class="new-standard-body form-dry-body" hidden >
							<div class="form-group">
								<div class="input-group m-b">
									<span class="input-group-addon">茶叶名称</span> <input type="text"
																					   placeholder="茶叶名称" name="teaName" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">标准投叶量</span> <input type="text"
																						placeholder="标准投叶量" name="leafStandard" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">标准温度</span> <input type="text"
																					   placeholder="标准温度" name="temperatureStandard"
																					   class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">总时长</span> <input type="text"
																					  placeholder="总时长" name="timeStandard" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">设备标准转速</span> <input
										type="text" placeholder="设备标准转速" name="speedStandard"
										class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">设备正转</span>
									<select class="form-control m-b" name="drumStatus" >
										<option value="1">true</option>
										<option value="0">false</option>
									</select>
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">标准含水量</span> <input type="text"
																						placeholder="标准含水量" name="waterStandard"
																						class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">风扇标准转速</span> <input type="text"
																					   placeholder="风扇标准转速" name="fanSpeed" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">风扇正转</span>
									<select class="form-control m-b" name="fanStatus" >
										<option value="1">true</option>
										<option value="0">false</option>
									</select>
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">默认为干燥使用标准</span>
									<select class="form-control m-b" name="isSelection" >
										<option value="1">true</option>
										<option value="0">false</option>
									</select>
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">阶段</span>
									<select class="form-control m-b" name="stage" >
										<option value="初干">初干</option>
										<option value="足干">足干</option>
									</select>
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
								<button type="submit" class="btn btn-primary"
										data-dismiss='modal' onclick="DryStandardCheck()">保存</button>
							</div>
						</form>
						
						<!-- 打包参数表单 -->
						<form class="new-standard-body form-package-body" hidden>
							<div class="form-group">
								<div class="input-group m-b">
									<span class="input-group-addon">茶系</span> <input type="text"
										placeholder="茶系" name="teaClass" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">茶叶叶形</span> <input type="text"
										placeholder="茶叶叶形" name="leavesType" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">茶叶品种</span> <input type="text"
										placeholder="茶叶品种" name="leavesVarieties" class="form-control">
								</div>
								<div class="input-group m-b">
									<span class="input-group-addon">打包重量值</span> <input type="text"
										placeholder="打包标准重量值" name="packWeight" class="form-control">
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
								<button type="submit" class="btn btn-primary"
									onclick="PackageStandardCheck()">保存</button>
							</div>
						</form>

					</div>
				</small>
			</div>
			<small class="font-bold"> </small>
		</div>
		<small class="font-bold"> </small>
	</div>

	<!-- 详情模态框 -->
	
	<div class="modal inmodal fade" id="detailModal" tabindex="-1"
		role="dialog" aria-hidden="true" style="display: none;">
		<div class="modal-dialog modal-lg">
			<div class="modal-content" id="standardDetail">
			</div>
			<small class="font-bold"> </small>
		</div>
	</div>
	
	<script src="${basePath }/static/js/jquery.min.js"></script>
	<script src="${basePath }/static/js/bootstrap.min.js"></script>
	<!-- bootstrap-table 表格插件 -->
	<script
		src="${basePath }/static/ajax/libs/bootstrap-table/bootstrap-table.min.js"></script>
	<script
		src="${basePath }/static/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
	<script
		src="${basePath }/static/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js"></script>
	<script
		src="${basePath }/static/ajax/libs/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.min.js"></script>
	<script
		src="${basePath }/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js"></script>
	<!-- jquery-validate 表单验证插件 -->
	<script src="${basePath }/static/ajax/libs/validate/jquery.validate.min.js"></script>
	<script src="${basePath }/static/ajax/libs/validate/messages_zh.min.js"></script>
	<script src="${basePath }/static/ajax/libs/validate/jquery.validate.extend.js"></script>
	<!-- jquery-validate 表单树插件 -->
	<script
		src="${basePath }/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js"></script>
	<!-- jquery-export 表格导出插件 -->
	<script
		src="${basePath }/static/ajax/libs/bootstrap-table/extensions/export/bootstrap-table-export.js"></script>
	<script
		src="${basePath }/static/ajax/libs/bootstrap-table/extensions/export/tableExport.js"></script>
	<!-- 遮罩层 -->
	<script src="${basePath }/static/ajax/libs/blockUI/jquery.blockUI.js"></script>
	<script src="${basePath }/static/ajax/libs/iCheck/icheck.min.js"></script>
	<script src="${basePath }/static/ajax/libs/layer/layer.min.js"></script>
	<script src="${basePath }/static/ajax/libs/layui/layui.js"></script>
	<script src="${basePath }/static/ruoyi/js/common.js?v=4.0.0"></script>
	<script src="${basePath }/static/ruoyi/js/ry-ui.js?v=4.0.0"></script>
	<script>
		var ctx = "\/";
	</script>
	<script src="${basePath }/static/ajax/libs/jquery-layout/jquery.layout-latest.js"></script>
	<script
		src="${basePath }/static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js"></script>
	<script>
		$("#standardHead").change(function(){
			// 显示前先将之前显示的表单隐藏，避免出现多个表单
			$("div#new-standard .new-standard-body").prop("hidden",true);
			var option = $("#standardHead").val();
			var element = "form." + option;
			booltag = $(element).prop("hidden",false);
		});
	</script>
	<script type="text/javascript">
	
	//获取项目根目录
	function getRootPath() {
		let href = window.document.location.href;
		let pathName = window.document.location.pathname;
		let index = href.indexOf(pathName);
		let localhost = href.substring(0, index);
		let project = pathName.substring(0, (pathName.substr(1)
				.indexOf('/')) + 1);

		return (localhost + project);
	}

	var rootPath = getRootPath();
	
 
				
	/*添加杀青标准表单验证*/
		function FixationStandardCheck() {
				$("form.form-fixation-body").validate({
		            rules: {
		            	teaName : {
		                    required: true,
		                },
		                freshLeafWaterContent : {
		                    required: true,
		                    number: true,     //输入必须是数字
		                    max: 1,			  //最大值为1
		                    min: 0.01        //输入的数字最小值为0.01，不能为0或者负数
		                },
		                leafStandard : {
		                    required: true,
		                    number: true
		                },
		                timeStandard : {
		                    required: true,
		                    number: true     //输入必须是数字
		                },
		                temperatureStandard : {
		                    required: true,
		                    number: true
		                },
		                humidity : {
		                    required: true,
		                    number: true
		                },
		                speedStandard : {
		                    required: true,
		                    number: true     //输入必须是数字
		                },
		                fanSpeed : {
		                    required: true,
		                    number: true     //输入必须是数字
		                },
		                killerStatus : {
		                    required: true
		                },
		                fanStatus : {
		                    required: true
		                },
		                waterStandard: {
		                	required: true,
		                	number: true,     //输入必须是数字
		                    max: 1,			  //最大值为1
		                    min: 0.01       //输入的数字最小值为0.01，不能为0或者负数
		                }
		            },
		            submitHandler: function() {
		                //此处写请求后台的ajax
		                let data = $("form.form-fixation-body").serialize();
		                $.ajax({
		                	url: rootPath + "/production/standard/addFixationStandard.do",
		                	type:"POST",
		                	data : data,
		                	dataType : "json",
		                    success : function (response) {
		                    	if(response.Result=="success"){
		                    		layer.alert(response.message, {icon: 1, title:'提示'});
		                    	}else{
		                    		layer.alert(response.message, {icon: 2, title:'提示'});
		                    	}
		                    }                	  
		                });
		                
		            }
		        });
	        
	    }
	
		
		function getFixationStandard() {
			$.ajax({
				url : rootPath
						+ "/production/standard/getFixationStandard.do",
				type : "POST",
				success : function(response) {
					if(response.RESUTL === "failed"){
	                	$.modal.alert(response.message);
	                }
				}
			});
		}
					
		
			
	/*添加揉捻标准表单验证*/
	function TwistStandardCheck() {
			$("form.form-twist-body").validate({
	            rules: {
	            	teaName : {
	                    required: true,
	                },
	                leafStandard : {
	                    required: true,
	                    number: true
	                },
	                temperatureStandard : {
	                    required: true,
	                    number: true
	                },
	                timeStandard : {
	                    required: true,
	                    number: true     //输入必须是数字
	                },
	                speedStandard : {
	                    required: true,
	                    number: true     //输入必须是数字
	                },
	                waterStandard : {
	                    required: true,
	                    number: true,     //输入必须是数字
	                    max: 1,			  //最大值为1
	                    min: 0.01        //输入的数字最小值为0.01，不能为0或者负数
	                },
	                twistType : {
	                    required: true
	                },
	                rateStandard:{
	                	required: true,
	                	number: true,     //输入必须是数字
	                    max: 1,			  //最大值为1
	                    min: 0.01       //输入的数字最小值为0.01，不能为0或者负数
	                },
	                cellRateStandard:{
	                	required: true,
	                	number: true,    //输入必须是数字
	                	max: 1,			  //最大值为1
		                min: 0.01 
	                },
	                pressureOne :{
	                	required: true,
	                	number: true,     //输入必须是数字
	                },
	                timeOne :{
	                	required: true,
	                	number: true     //输入必须是数字
	                },
	                pressureTwo :{
	                	required: true,
	                	number: true,     //输入必须是数字
	                },
	                timeTwo :{
	                	required: true,
	                	number: true     //输入必须是数字
	                },
	                pressureThree :{
	                	required: true,
	                	number: true,     //输入必须是数字
	                },
	                timeThree :{
	                	required: true,
	                	number: true     //输入必须是数字
	                }	                
	            },
	        
	            submitHandler: function() {
	                //此处写请求后台的ajax
	                let data = $("form.form-twist-body").serialize();
	                $.ajax({
	                	url: rootPath + "/production/standard/addTwistStandard.do",
	                	type:"POST",
	                	data : data,
	                	dataType : "json",
	                    success : function (response) {
	                    	if(response.Result=="success"){
	                    		layer.alert(response.message, {icon: 1, title:'提示'});
	                    	}else{
	                    		layer.alert(response.message, {icon: 2, title:'提示'});
	                    	}
	                    }                	  
	                });
	                
	            }
	        })
        
    }

	
	/*添加干燥标准表单验证*/
    function DryStandardCheck() {
        $("form.form-dry-body").validate({
            rules: {
                teaName : {
                    required: true,
                },
                leafStandard : {
                    required: true,
                    number: true
                },
                temperatureStandard : {
                    required: true,
                    number: true
                },
                timeStandard : {
                    required: true,
                    number: true     //输入必须是数字
                },
                speedStandard : {
                    required: true,
                    number: true     //输入必须是数字
                },
                waterStandard : {
                    required: true,
                    number: true,     //输入必须是数字
                    max: 1,			  //最大值为1
                    min: 0.01        //输入的数字最小值为0.01，不能为0或者负数
                },
                fanSpeed : {
                    required:true,
                    number:true,
				},
                fanStatus : {
                    required:true
                },
                drumStatus : {
                    required:true
				}
            },
            //错误提示信息
            messages: {
            },
            submitHandler: function() {

            }
        })
        let data = $("form.form-dry-body").serialize();
        $.ajax({
            url : rootPath + "/production/addDryStandard.do",
            type : "POST",
            data : data,
            dataType : "json",
            success : function (response) {
            	if(response.Result=="success"){
            		layer.alert(response.message, {icon: 1, title:'提示'});
            	}else{
            		layer.alert(response.message, {icon: 2, title:'提示'});
            	}
            }
        });
    }
	/*修改干燥标准表单验证*/
    function updateDryStandardCheck() {
        let data = $("form.form-updateDry-body").serialize();
        $.ajax({
            url : rootPath + "/production/updateDryStandard.do",
            type : "POST",
            data : data,
            dataType : "json",
            success : function (response) {
                $.modal.alert(response.message);
            }
        });

    }
	/*获取打包标准*/
	function getProductionPackStandard() {
		var teaId=1;
		$.ajax({
			url : rootPath+"/production/standard/getProductionPackStandard.do",
			type : "POST",
			dataType:"json",
			data:{
				teaId:teaId
			},
			success : function(response) {
				$("#packTeaName").html(response.PackStandardVo.teaName);
				$("#packTeaTime").html(response.PackStandardVo.lastTime);
			}
		});
	}
	
	/*添加打包标准表单验证*/
	function PackageStandardCheck() {
			$("form.form-package-body").validate({
	            rules: {
	            	teaClass : {
	                    required: true,
	                },
	                leavesVarieties : {
	                    required: true,
	                },
	                leavesType : {
	                    required: true,
	                },
	                packWeight : {
	                    required: true,
	                    number: true     //输入必须是数字
	                }
	            },
	            submitHandler: function() {
	                //此处写请求后台的ajax
	                let data = $("form.form-package-body").serialize();
	                $.ajax({
	                	url: rootPath + "/production/standard/addPackStandard.do",
	                	type:"POST",
	                	data : data,
	                	dataType : "json",
	                    success : function (response) {
	                    	if(response.Result=="success"){
	                    		layer.alert(response.message, {icon: 1, title:'提示'});
	                    	}else{
	                    		layer.alert(response.message, {icon: 2, title:'提示'});
	                    	}
	                    }             	  
	                });
	                
	            }
	        })
    }
	</script>
	
	<script type="text/javascript">	
	//standard_id的第一位代表流程：0杀青，1揉捻，2干燥，3打包
	function showDetail(obj){
				var node1 = obj.parentNode.parentNode.children[2];
				var teaName = node1.innerText;
				var node2 = obj.parentNode.parentNode.children[3];
				var standardId = node2.innerText;
				$.ajax({
					url : rootPath
							+ "/production/standard/queryStandardDetail.do",
					type : "POST",
					data : {teaName : teaName, standardId : standardId},
					success : function(response) {
						var response = eval("("+response+")");
		            	if(response.RESUTL === "failed"){
		                	$.modal.alert(response.message);
		                }else{
		                	// 公共标准部分
		                	var baseStandard = response.baseStandard;
		                	// 不同的部分
		                	var standard = response.standard;
		                	
							var detail = "";
							var node3 = obj.parentNode.parentNode.children[3];
							var standardId = node2.innerText;
							var head = standardId.substr(0,1);
							var standardIdLength = standardId.length;
							// 不同流程显示不同信息
							if( standardIdLength <= 8 ){// 杀青
								detail = "<div class='modal-header'>"
				        		+"<button type='button' class='close' data-dismiss='modal'>"
				        		+"<span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button>"
				        		+"<h4 class='modal-title'>"+ standard.teaName +"&nbsp生产参数</h4>"
				        		+"</small></div><small class='font-bold'><div class='modal-body'><table id='bootstrap-table' data-mobile-responsive='true' class='table table-hover'>"
				        		+"<thead><tr><th><div class='th-inner '>参数名</div><div class='fht-cell'></div></th><th><div class='th-inner '>参数值</div>"
				        		+"<div class='fht-cell'></div></th></tr></thead><tbody>"
				        		+"<tr data-index='0'><td>茶叶名称</td><td>"+ standard.teaName +"</td>"
				        		+"</tr><tr data-index='1'><td>标准投叶量</td><td>"+ standard.leafStandard +"</td></tr>"
				        		+"</tr><tr data-index='2'><td>标准温度</td><td>"+ standard.temperatureStandard +"</td></tr>"
				        		+"</tr><tr data-index='3'><td>总时长</td><td>"+ standard.timeStandard +"</td></tr>"
				        		+"</tr><tr data-index='4'><td>设备标准转速</td><td>"+ standard.speedStandard +"</td></tr>"
				        		+"</tr><tr data-index='5'><td>标准含水量</td><td>"+ standard.waterStandard +"</td></tr>"
				        		+"</tr><tr data-index='6'><td>湿度</td><td>"+ standard.humidity +"</td></tr>"
				        		+"</tr><tr data-index='7'><td>风扇转速</td><td>"+ standard.fanSpeed +"</td></tr>"
				        		+"</tr><tr data-index='8'><td>风扇状态</td><td>"+ standard.fanStatus +"</td></tr>"
				        		+"</tr><tr data-index='9'><td>杀青机状态</td><td>"+ standard.killerStatus +"</td></tr>"
				        		+"</tr><tr data-index='10'><td>鲜叶含水量</td><td>"+ standard.freshLeafWaterContent +"</td></tr>"
				        		+"</tbody></table></div><div class='modal-footer'>"
				        		+"<button type='button' class='btn btn-white' data-dismiss='modal'>关闭</button><button type='button' class='btn btn-primary'>修改</button>"
				        		+"</div></small></div><small class='font-bold'> </small>";
							}else if( head == "1" ){// 揉捻
								detail = "<div class='modal-header'>"
				        		+"<button type='button' class='close' data-dismiss='modal'>"
				        		+"<span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button>"
				        		+"<h4 class='modal-title'>"+ standard.teaName +"&nbsp生产参数</h4>"
				        		+"</small></div><small class='font-bold'><div class='modal-body'><table id='bootstrap-table' data-mobile-responsive='true' class='table table-hover'>"
				        		+"<thead><tr><th><div class='th-inner '>参数名</div><div class='fht-cell'></div></th><th><div class='th-inner '>参数值</div>"
				        		+"<div class='fht-cell'></div></th></tr></thead><tbody>"
				        		+"<tr data-index='0'><td>茶叶名称</td><td>"+ standard.teaName +"</td>"
				        		+"</tr><tr data-inde x='1'><td>标准投叶量</td><td>"+ baseStandard.leafStandard +"</td></tr>"
				        		+"</tr><tr data-index='2'><td>标准温度</td><td>"+ baseStandard.temperatureStandard +"</td></tr>"
				        		+"</tr><tr data-index='3'><td>总时长</td><td>"+ baseStandard.timeStandard +"</td></tr>"
				        		+"</tr><tr data-index='4'><td>设备标准转速</td><td>"+ baseStandard.speedStandard +"</td></tr>"
				        		+"</tr><tr data-index='5'><td>标准含水量</td><td>"+ baseStandard.waterStandard +"</td></tr>"
				        		+"</tr><tr data-index='6'><td>揉捻方式</td><td>"+ standard.twistType +"</td></tr>"
				        		+"</tr><tr data-index='7'><td>标准成条率</td><td>"+ standard.rateStandard +"</td></tr>"
				        		+"</tr><tr data-index='8'><td>标准细胞破损率</td><td>"+ standard.cellRateStandard +"</td></tr>"
				        		+"</tr><tr data-index='9'><td>阶段1压力</td><td>"+ standard.pressureOne +"</td></tr>"
				        		+"</tr><tr data-index='10'><td>阶段1时长</td><td>"+ standard.timeOne +"</td></tr>"
				        		+"</tr><tr data-index='11'><td>阶段2压力</td><td>"+ standard.pressureTwo +"</td></tr>"
				        		+"</tr><tr data-index='12'><td>阶段2时长</td><td>"+ standard.timeTwo +"</td></tr>"
				        		+"</tr><tr data-index='13'><td>阶段3压力</td><td>"+ standard.pressureThree +"</td></tr>"
				        		+"</tr><tr data-index='14'><td>阶段3时长</td><td>"+ standard.timeThree +"</td></tr>"
				        		+"</tbody></table></div><div class='modal-footer'>"
				        		+"<button type='button' class='btn btn-white' data-dismiss='modal'>关闭</button><button type='button' class='btn btn-primary'>修改</button>"
				        		+"</div></small></div><small class='font-bold'> </small>";
							
							}else if( head == "2" ){// 干燥
								detail = "<form class=\"form-updateDry-body\"  >"
                                    +"<input class='time-input' type='hidden' name='standerId'  value="+standard.standerId + "  / >"
                                    +"<div class='modal-header'>"
                                    +"<button type='button' class='close' data-dismiss='modal'>"
                                    +"<span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button>"
                                    +"<h4 class='modal-title'>"+ standard.teaName +"&nbsp生产参数</h4>"
                                    +"</small></div><small class='font-bold'><div class='modal-body'><table id='bootstrap-table' data-mobile-responsive='true' class='table table-hover'>"
                                    +"<thead><tr><th><div class='th-inner '>参数名</div><div class='fht-cell'></div></th><th><div class='th-inner '>参数值</div>"
                                    +"<div class='fht-cell'></div></th></tr></thead><tbody>"
                                    +"<tr data-index='0'><td>茶叶名称</td><td>"
                                    +"<input type='text' class='form-control' name='teaName' value="+standard.teaName + "  / >"
                                    +"</td>"
                                    +"</tr><tr data-index='1'><td>标准投叶量</td><td>"
                                    +"<input type='text' class='form-control'  value="+standard.leafStandard + "  / >" +"</td></tr>"
                                    +"</tr><tr data-index='2'><td>标准温度</td><td>"+"<input type='text' class='form-control' name='temperatureStandard'  value="+standard.temperatureStandard + "  / >" +"</td></tr>"
                                    +"</tr><tr data-index='3'><td>总时长</td><td>"+"<input type='text' class='form-control'  name='timeStandard' value="+standard.timeStandard + "  / >"  +"</td></tr>"
                                    +"</tr><tr data-index='4'><td>设备标准转速</td><td>"+"<input type='text' class='form-control' name='speedStandard' value="+standard.speedStandard + "  / >"  +"</td></tr>"
                                    +"</tr><tr data-index='5'><td>标准含水量</td><td>"+"<input type='text' class='form-control' name='waterStandard' value="+standard.waterStandard + "  / >"  +"</td></tr>"
                                    +"</tr><tr data-index='6'><td>风扇标准速度</td><td>"+"<input type='text' class='form-control' name='fanSpeed' value="+standard.fanSpeed + "  / >"  +"</td></tr>"
                                    +"</tr><tr data-index='7'><td>风扇标准状态为正转</td><td>"+"<input type='text' class='form-control' name='fanStatus' value="+standard.fanStatus + "  / >" +"</td></tr>"
                                    +"</tr><tr data-index='8'><td>设备标准状态为正转</td><td>"+"<input type='text' class='form-control' name='drumStatus' value="+standard.drumStatus + "  / >" +"</td></tr>"
                                    +"</tr><tr data-index='9'><td>阶段</td><td>"+"<input type='text' class='form-control' name='stage' value="+standard.stage + "  / >" +"</td></tr>"
                                    +"</tr><tr data-index='10'><td>默认使用标准</td><td>"+"<input type='text' class='form-control' name='isSelection' value="+standard.isSelection + "  / >" +"</td></tr>"
                                    +"</tbody></table></div><div class='modal-footer'>"
                                    +"<button type='button' class='btn btn-white' data-dismiss='modal'>关闭</button><button type='button' data-dismiss='modal' onclick='updateDryStandardCheck()' class='btn btn-primary' >修改</button>"
                                    +"</div></small></div><small class='font-bold'> </small>"
                                    + "</form>";
							}else if( head == "3" ){// 打包
								detail = "<div class='modal-header'>"
								+"<button type='button' class='close' data-dismiss='modal'>"
								+"<span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button>"
								+"<h4 class='modal-title'>"+ standard.teaName +"&nbsp生产参数</h4>"
								+"</small></div><small class='font-bold'><div class='modal-body'><table id='bootstrap-table' data-mobile-responsive='true' class='table table-hover'>"
								+"<thead><tr><th><div class='th-inner '>参数名</div><div class='fht-cell'></div></th><th><div class='th-inner '>参数值</div>"
								+"<div class='fht-cell'></div></th></tr></thead><tbody>"
								+"<tr data-index='0'><td>茶叶名称</td><td>"+ standard.teaName +"</td>"
								+"</tr><tr data-index='1'><td>茶系</td><td>"+ standard.teaClass +"</td></tr>"
								+"</tr><tr data-index='2'><td>茶叶品种</td><td>"+ standard.leavesVarieties +"</td></tr>"
								+"</tr><tr data-index='3'><td>茶叶叶形</td><td>"+ standard.leavesType +"</td></tr>"
								+"</tr><tr data-index='4'><td>标准重量值</td><td>"+ standard.packWeight +"</td></tr>"
								+"</tbody></table></div><div class='modal-footer'>"
								+"<button type='button' class='btn btn-white' data-dismiss='modal'>关闭</button>"
								+"</div></small></div><small class='font-bold'> </small>";
							}
							
				        	$("#standardDetail").html(detail);
				        	
		                }
		         		
					}
						
				});
				
			}
	</script>
	
</body>
</html>